//
// Source code recreated from ConfigVo .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package com.ht.modules.system.online.cgform.util;

import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import com.ht.modules.system.online.cgform.entity.OnlCgformField;
import org.jeecgframework.poi.handler.impl.ExcelDataHandlerDefaultImpl;
import org.jeecgframework.poi.util.PoiPublicUtil;

public class CgFormExcelHandler extends ExcelDataHandlerDefaultImpl {
    Map<String, OnlCgformField> fieldMap;

    public CgFormExcelHandler(List<OnlCgformField> lists) {
        this.fieldMap = this.convertDate(lists);
    }

    private Map<String, OnlCgformField> convertDate(List<OnlCgformField> lists) {
        Map<String, OnlCgformField> maps = new HashMap();
        Iterator var3 = lists.iterator();

        while(var3.hasNext()) {
            OnlCgformField cgFormFieldEntity = (OnlCgformField)var3.next();
            maps.put(cgFormFieldEntity.getDbFieldTxt(), cgFormFieldEntity);
        }

        return maps;
    }

    public void setMapValue(Map<String, Object> map, String originKey, Object value) {
        if (value instanceof Double) {
            map.put(this.getRealKey(originKey), PoiPublicUtil.doubleToString((Double)value));
        } else {
            map.put(this.getRealKey(originKey), value == null ? "" : value.toString());
        }

    }

    private String getRealKey(String originKey) {
        return this.fieldMap.containsKey(originKey) ? "$mainTable$" + ((OnlCgformField)this.fieldMap.get(originKey)).getDbFieldName() : "$subTable$" + originKey;
    }
}
